package com.linciping.gradle.asm.transform

import org.objectweb.asm.ClassReader
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.commons.AdviceAdapter

class CustomMethodVisitor(
    classReader: ClassReader,
    methodVisitor: MethodVisitor?,
    private val isClickMethod: Boolean, access: Int, name: String?, private val descriptor: String?
) : AdviceAdapter(
    ASM7, methodVisitor,
    access, name, descriptor,
) {
    private val methodNameAndDesc = "${name}$descriptor"

    override fun onMethodEnter() {
        if (isClickMethod) {
            println("method=$methodNameAndDesc;")
        }
    }
}